#ifndef _MOTION_KERNEL_H_
#define _MOTION_KERNEL_H_
#ifdef ARDUINO

#include<Arduino.h>
#endif
#include "iec_types.h"


typedef unsigned long long uint64_t;

///***************************************///
#ifdef __cplusplus
extern "C"{
#endif

int __MK_Init(void);

void __MK_Cleanup(void);

void __MK_Retrieve(void);

void __MK_Publish(void);

int __MK_Alloc_AXIS_REF(void);

//do not use it when is running
//common_ticktime in ns
void __MK_SetCalcPeriodT(uint64_t common_ticktime);

//use before __MK_Retrieve()
void __MK_SetAxisActualRawPos(int AxisIndex, IEC_DINT ActualRawPosition);

void __MK_SetAxisActualPowerFeedBack(int AxisIndex, IEC_BOOL PowerFeedback);

void __MK_SetAxisDigitalInputsEnable(int AxisIndex, IEC_BOOL Enable);

/* DigitalInputs:
 * 0x0001 - Limit Negitive
 * 0x0002 - Limit Positive
 * 0x0004 - Home Switch
 * 0x10000 - Touch Probe Switch
 */
void __MK_SetAxisActualDigitalInputs(int AxisIndex, IEC_DWORD DigitalInputs);

//use after __MK_Publish()
void __MK_GetAxisRawPosSetPoint(int AxisIndex, IEC_DINT *RawPositionSetPoint);

void __MK_GetAxisRawPowerSetState(int AxisIndex, IEC_BOOL *RawPowerSetState);

#ifdef __cplusplus
};
#endif

#endif
//Eof
